<?php

/*  lamp-shade_0.1
 *  License: GNU GPL v3
 *  File: ./modules/standard/connect_db.php
 *  Last Mod.:  02/11/11 by Werner
 *  Authors:    Werner Roets
 *              Frank Adrian
 *  Description:
 *  Use this class to connect to and query the database.
 */

require_once("./modules/standard/settings.php");

class Database
{

    public function Connect()
    {
        mysql_connect(Settings::$hostname,Settings::$username,Settings::$password);
        mysql_selectdb(Settings::$db_name);
    }
    
    public function Query($sql)
    {
        $result = mysql_query($sql);
             
        	
        return $result;
    }
    
    public function Numrows($result)
    {
        $ret = mysql_numrows($result);
        return $ret;
    }
    public function Disconnect()
    {
        mysql_close();
    }
    
    public function __destruct()
    {
        Disconnect();
    }
    
}
?>